// 全局引入
// import 'core-js'
// 手动按需引入
// import 'core-js/es/promise'

import count from "./js/count";

import { add } from "./js/math";
// 想要webpack打包资源，必须引入
import "./css/index.css"
import "./less/index.less"
import "./sass/index.sass"
import "./sass/index.scss"

import "./fonts/iconfont.js"
import "./fonts/iconfont.css"




// var sum2 = 1 +2;

console.log(count(2, 2));
console.log(add(2, 2));


document.getElementById("btn").addEventListener("click", function () {
  import(/* webpackChunkName: "sum" */ "./js/sum.js").then(({ sum }) => {
    console.log(sum(1, 2, 3, 4, 5));
  })
})


if (module.hot) {
  module.hot.accept()
  // module.hot.accept("./js/count.js")
}

new Promise((resolve)=>{
  setTimeout(()=>{
    resolve()
  },1000)
})


console.log([1,2,3,4,5].includes(1))


if ('serviceWorker' in navigator) {
  window.addEventListener('load', () => {
    navigator.serviceWorker.register('/service-worker.js').then(registration => {
      console.log('SW registered: ', registration);
    }).catch(registrationError => {
      console.log('SW registration failed: ', registrationError);
    });
  });
}
